<cd-table #table
          [autoReload]="false"
          [data]="buckets"
          [columns]="columns"
          columnMode="flex"
          selectionType="multiClick"
          [hasDetails]="true"
          (setExpandedRow)="setExpandedRow($event)"
          (updateSelection)="updateSelection($event)"
          identifier="bid"
          (fetchData)="getBucketList($event)"
          [status]="tableStatus">
  <cd-table-actions class="table-actions"
                    [permission]="permission"
                    [selection]="selection"
                    [tableActions]="tableActions">
  </cd-table-actions>
  <cd-rgw-bucket-details *cdTableDetail
                         [selection]="expandedRow">
  </cd-rgw-bucket-details>
</cd-table>

<ng-template #bucketSizeTpl
             let-row="data.row">
  <cd-usage-bar *ngIf="row.bucket_quota.max_size > 0 && row.bucket_quota.enabled; else noSizeQuota"
                [total]="row.bucket_quota.max_size"
                [used]="row.bucket_size">
  </cd-usage-bar>

  <ng-template #noSizeQuota
               i18n>No Limit</ng-template>
</ng-template>

<ng-template #bucketObjectTpl
             let-row="data.row">
  <cd-usage-bar *ngIf="row.bucket_quota.max_objects > 0 && row.bucket_quota.enabled; else noObjectQuota"
                [total]="row.bucket_quota.max_objects"
                [used]="row.num_objects"
                [isBinary]="false">
  </cd-usage-bar>

  <ng-template #noObjectQuota
               i18n>No Limit</ng-template>
</ng-template>

<ng-template #deleteTpl>
  <cd-alert-panel type="danger"
                  i18n>
    Buckets might still have underlying data depending on your bucket configuration
  </cd-alert-panel>
</ng-template>
